<template>
  <div class="app-container">
    <div class="head">
      <el-form :model="queryParams" ref="queryForm" :inline="true">
        <el-form-item label="" prop="">
          <el-input v-model="queryParams.query" placeholder="卡编号/卡名称/账号名称/钱包地址" clearable :style="{width: inputWidth}"
            @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item>
          <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
          <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
        </el-form-item>
      </el-form>
    </div>
    <div class="listBox">
      <div class="listBox_head">
        <export-excel-button title="神椰账户管理" action="/equityManager/shenyeAccount/export" :params="ExportParams" />
      </div>
      <el-table v-loading="loading" :data="tableList" stripe border>
        <el-table-column label="序号" align="center" type="index" width="64px" />
        <el-table-column label="卡编号" align="center" prop="cardNo" :show-overflow-tooltip="true" />
        <el-table-column label="卡名称" align="center" prop="cardName" :show-overflow-tooltip="true" />
        <el-table-column label="账号名称" align="center" prop="name" :show-overflow-tooltip="true" />
        <el-table-column label="用户钱包地址" align="center" prop="address" />
        <el-table-column label="DDCid" align="center" prop="ddcId" :show-overflow-tooltip="true" />
        <el-table-column label="打入时间" align="center" prop="createTime" :show-overflow-tooltip="true" />
        <el-table-column label="操作" align="center" width="120" class-name="small-padding fixed-width">
          <template slot-scope="scope">
            <el-button size="mini" type="text" @click="handleUpdate(scope.row)">转增</el-button>
          </template>
        </el-table-column>
      </el-table>
      <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
        @pagination="getList" />
    </div>
    <Dialog ref="dialog" @refresh="getList"></Dialog>
  </div>
</template>

<script>
  import {
    shenyeAccountLs,
  } from "@/api/equityManager/sYAccountManagement";
  import Dialog from "@/views/equityManager/sYAccountManagement/dialog";
  import ExportExcelButton from "@/components/ExportExcelButton/index";
  export default {
    // dicts: ['equity_card_issue_type', 'equity_card_sell_status'],
    name: "",
    components: {
      Dialog,
      ExportExcelButton
    },
    data() {
      return {
        labelWidth: '120px',
        inputWidth: '300px',
        // 遮罩层
        loading: false,
        // 总条数
        total: 0,
        // 表格数据
        tableList: [],
        // 查询参数
        queryParams: {
          pageNum: 1,
          pageSize: 10,
          query: '', //卡编号/卡名称/账号名称/钱包地址
        },
      };
    },
    computed: {
      ExportParams() {
        const params = {
          ...this.queryParams,
        };
        return params;
      },
    },
    created() {
      this.getList();
    },
    methods: {
      /** 查询列表 */
      getList() {
        this.loading = true;
        shenyeAccountLs(this.queryParams).then(response => {
          this.tableList = response.rows;
          this.total = response.total;
          this.loading = false;
        });
      },
      // 表单重置
      reset() {
        this.date = []
        this.queryParams = {
          pageNum: 1,
          pageSize: 10,
          query: '',
        }
        this.handleQuery()
      },
      handleQuery() {
        this.queryParams.pageNum = 1;
        this.getList();
      },
      /** 重置按钮操作 */
      resetQuery() {
        // this.resetForm("queryForm");
        this.reset();
        this.handleQuery();
      },
      /** 转赠按钮操作 */
      handleUpdate(row) {
        this.$refs.dialog.open(row.customerCardId);
      },
    }
  };

</script>
<style scoped>
  .head {
    box-shadow: 0px 4px 12px 0px rgb(1 41 99 / 6%);
    background-color: #fff;
    border-radius: 8px;
    padding: 20px 20px 0;
  }

  .listBox {
    box-shadow: 0px 4px 12px 0px rgb(1 41 99 / 6%);
    background-color: #fff;
    border-radius: 8px;
    padding: 20px 20px;
    margin-top: 10px;
  }

  .listBox_head {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 20px;
  }

  .img_box {
    width: 80px;
    height: 80px;
  }

  .time_box {
    cursor: pointer;
  }

  .time_box:hover {
    color: #1890FF;
  }

</style>
